//
//  AdTypeVipHeaderCell.swift
//  Automobile
//
//  Created by erkebulan elzhan on 9/1/20.
//  Copyright © 2020 erkebulan elzhan. All rights reserved.
//

import UIKit

final class AdTypeVipHeaderCell: UITableViewCell {
    
    private lazy var titleLbl: UILabel = {
        let titleLbl = UILabel()
        titleLbl.textColor = .darkBlueColor
        titleLbl.text = "VIP"
        titleLbl.font = .systemFont(ofSize: 24, weight: .medium)
        return titleLbl
    }()
    
    private lazy var subtitleLbl: UILabel = {
        let subtitleLbl = UILabel()
        subtitleLbl.textColor = .darkBlueColor
        subtitleLbl.text = "Выберите вид объявления в поиске:"
        subtitleLbl.font = .systemFont(ofSize: 12)
        subtitleLbl.numberOfLines = 0
        return subtitleLbl
    }()
    
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.addViews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    public func updateUI (title: String, message: String) {
        self.titleLbl.text = title
        self.subtitleLbl.text = message
    }
    
    private func addViews () {
        contentView.backgroundColor = .lightBlueColor
        contentView.addSubview(titleLbl)
        contentView.addSubview(subtitleLbl)
        
        subtitleLbl.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview().offset(-8)
            make.leading.trailing.equalToSuperview().inset(16)
        }
        titleLbl.snp.makeConstraints { (make) in
            make.bottom.equalTo(subtitleLbl.snp.top).offset(-12)
            make.leading.trailing.equalTo(subtitleLbl)
            make.top.equalToSuperview().inset(8)
        }
    }
}

